#include <iostream>

class StackOnly
{
public:
	static StackOnly CreateObj()
	{
		return StackOnly();
	}

// 禁掉operator new可以把下面用new 调用拷贝构造申请对象给禁掉
// StackOnly obj = StackOnly::CreateObj();
// StackOnly* ptr3 = new StackOnly(obj);
	void* operator new(size_t size) = delete;
	void operator delete(void* p) = delete;
private:
	StackOnly()  
		:_a(0)
	{}
private:
	int _a;
};


int main()
{
	StackOnly s = StackOnly::CreateObj();
    // new StackOnly(s);

	return 0;
}
